home *** CD-ROM | disk | FTP | other *** search
-
- EXAMPLE 4 :
-
- /****************************************************
- * This is an example of the array of pointers to test
- * objects. It shows how the array is defined and how
- * it can be searched for a specific test object. It
- * also shows how, once the index to the correct test
- * object is found, the pointer to the test object can
- * be used to invoke the object's methods.
- *
- * This code is compiled to ROM.
- ****************************************************/
-
- file main.c
-
-
- extern TEST_STR test_a();
- extern TEST_STR test_b();
- extern TEST_STR test_c();
-
- TEST_CLASS *test;
- TEST_CLASS (const *test_ptr[]) = {&test_a,
- &test_b,
- &test_c,
- 0};
-
- /* assume name is a parameter set to */
- /* "Test A" select the Test A test object */
-
- test = test_ptr[0];
- while(test != 0) {
- if(strcmp(test->Test_Name,name) == 0) break;
- test++;
- }
-
- /* and use it to run the test */
- .
- .
- test->init_object();
- .
- .
- test->process_data(params,results);
- .
- .
- test->disp_results(results);
- .
- .
-
-
-